package com.xrh.xdemo.service.entity;

import java.io.Serializable;
import java.util.Date;

import org.springframework.format.annotation.DateTimeFormat;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import com.fasterxml.jackson.annotation.JsonFormat;

import lombok.Builder;
import lombok.Data;
import lombok.experimental.Tolerate;


/**
* 菜单
*/
@Data
@TableName(value = "menu" , autoResultMap = true)
@Builder
public class MenuEntity  implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
    /**主键id */
	@JsonFormat(shape = JsonFormat.Shape.STRING)
	@TableId(value="id" ,type = IdType.ASSIGN_ID)
	private Long id;

	/**创建人id */
	@TableField(value = "create_user_id" , fill = FieldFill.INSERT)
	private Long createUserId;

	/**创建人账号 */
	@TableField(value = "create_user_account" , fill = FieldFill.INSERT)
	private String createUserAccount;

	/**创建人 */
	@TableField(value = "create_user_name" , fill = FieldFill.INSERT)
	private String createUserName;

	/**创建时间 */
	@TableField(value="create_time",fill = FieldFill.INSERT)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date createTime;

	/**最后更新人id */
	@TableField(value="update_user_id",fill = FieldFill.INSERT_UPDATE)
	private Long updateUserId;

	/**更新人账号 */
	@TableField(value="update_user_account",fill = FieldFill.INSERT_UPDATE)
	private String updateUserAccount;

	/**更新人 */
	@TableField(value="update_user_name",fill = FieldFill.INSERT_UPDATE)
	private String updateUserName;

	/**最后更新时间 */
	@TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date updateTime;

	/**更新版本号 */
	@Version
	@TableField(value="update_version",fill = FieldFill.INSERT)
	private Integer updateVersion;

	/**删除标识(0:未删除,时间戳:已经删除) */
	@TableLogic(value="0" , delval="REPLACE(unix_timestamp(current_timestamp(3)),'.','')")
	@TableField(value="del_flag")
	private Long delFlag;

	/**菜单名称 */
	@TableField("name")
	private String name;

	/**菜单图标 */
	@TableField("icon")
	private String icon;

	/**菜单链接地址 */
	@TableField("url")
	private String url;

	/**父菜单id */
	@TableField("parent_menu_id")
	private Long parentMenuId;

	/**排序序号 */
	@TableField("sort_no")
	private Long sortNo;
	
	/**类型 @link MenuTypeConstants*/
	@TableField("type")
	private Integer type;

	/**编号 */
	@TableField("menu_no")
	private String menuNo;
	
	/**系统菜单(0:否,1:是) */
	@TableField("sys_flag")
	private Integer sysFlag;
	
    @Tolerate
    public MenuEntity(){}
}
